package com.eshipenet.shipnet.equipmentextbuilder
import java.util.Properties

import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer
import play.api.libs.json.JsValue

object EquipmentExtActionSinkProvider {

  def kafkaSink: FlinkKafkaProducer[(String, JsValue)] = {
    val props = Map(
      "bootstrap.servers" -> "kafka-server:9092",
      "group.id"          -> "EquipmentExtActionSink"
    )
    val properties = new Properties()
    props.foreach(kv => properties.setProperty(kv._1, kv._2))
    new FlinkKafkaProducer[(String, JsValue)]("EquipmentExt",
                                              new JsonKafkaSerializer("EquipmentExt"),
                                              properties,
                                              FlinkKafkaProducer.Semantic.EXACTLY_ONCE)
  }
}
